package counting;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.math.BigInteger;
import java.util.ArrayList;

/*
 * Problem 110603.
 */
class Main 
{
	public static void main(String [] args)
	{
		new Counting().start();
	}
}

class Counting
{
	public void start()
	{
		BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
		
		try
		{
			String input;
			ArrayList<BigInteger> inputList = new ArrayList<BigInteger>();
			
			BigInteger [] values = createPreDefinedVals();
			
			while (!(input = reader.readLine()).equals(""))
			{
				BigInteger integer = new BigInteger(input);
				
				count(integer, values);
			}
		} 
		catch(IOException ex)
		{
			  ex.printStackTrace();
		}
	}
	
	
	public void count(BigInteger integer, BigInteger [] values)
	{		
			System.out.println(values[integer.intValue()]);
	}
	
	public BigInteger [] createPreDefinedVals()
	{
		BigInteger [] stuff = new BigInteger[1001];
		
		BigInteger oneCount = new BigInteger("2");
		BigInteger twoCount = new BigInteger("5");
		BigInteger threeCount = new BigInteger("13");
		
		stuff[1] = oneCount;
		stuff[2] = twoCount;
		stuff[3] = threeCount;
		
		for (int i = 4; i < stuff.length; i++)
		{
			stuff[i] = stuff[i - 1].multiply(new BigInteger("2")).add(stuff[i - 2]).add(stuff[i - 3]);
		}
		
		return stuff;
	}
}